package com.lkd.shoppingcart.dao.impl;

import java.util.List;

import com.lkd.shoppingcart.dao.OrderDetailDao;
import com.lkd.shoppingcart.entity.OrdersDetail;

public class OrderDetailDaoImpl extends BaseDao implements OrderDetailDao {

	@Override
	public int addOrderDetail(String orderId, Integer productId, Integer quantity) {
		String sql = "insert into orders_item(orderId, productId, quantity) values(?, ?, ?)";
		return update(sql, orderId, productId, quantity);
	}

	@Override
	public List<OrdersDetail> queryByOrderId(String orderId) {
		String sql = "select orderId, productId, productName, price, quantity from orders_detail where orderId = ?";
		return queryForList(OrdersDetail.class, sql, orderId);
	}

}
